/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.sonrisas.tools.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author DIEGOALV
 */
@Entity
@Table(name = "ubigeo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Ubigeo.findAll", query = "SELECT u FROM Ubigeo u"),
    @NamedQuery(name = "Ubigeo.findByIdUbigeo", query = "SELECT u FROM Ubigeo u WHERE u.idUbigeo = :idUbigeo"),
    @NamedQuery(name = "Ubigeo.findByCoddepto", query = "SELECT u FROM Ubigeo u WHERE u.coddepto = :coddepto"),
    @NamedQuery(name = "Ubigeo.findByCodprov", query = "SELECT u FROM Ubigeo u WHERE u.codprov = :codprov"),
    @NamedQuery(name = "Ubigeo.findByCoddist", query = "SELECT u FROM Ubigeo u WHERE u.coddist = :coddist"),
    @NamedQuery(name = "Ubigeo.findByNombre", query = "SELECT u FROM Ubigeo u WHERE u.nombre = :nombre")})
public class Ubigeo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idUbigeo")
    private Integer idUbigeo;
    @Basic(optional = false)
    @Column(name = "coddepto")
    private int coddepto;
    @Basic(optional = false)
    @Column(name = "codprov")
    private int codprov;
    @Basic(optional = false)
    @Column(name = "coddist")
    private int coddist;
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idUbigeo")
    private List<Clinica> clinicaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idUbigeo")
    private List<Persona> personaList;

    public Ubigeo() {
    }

    public Ubigeo(Integer idUbigeo) {
        this.idUbigeo = idUbigeo;
    }

    public Ubigeo(Integer idUbigeo, int coddepto, int codprov, int coddist, String nombre) {
        this.idUbigeo = idUbigeo;
        this.coddepto = coddepto;
        this.codprov = codprov;
        this.coddist = coddist;
        this.nombre = nombre;
    }

    public Integer getIdUbigeo() {
        return idUbigeo;
    }

    public void setIdUbigeo(Integer idUbigeo) {
        this.idUbigeo = idUbigeo;
    }

    public int getCoddepto() {
        return coddepto;
    }

    public void setCoddepto(int coddepto) {
        this.coddepto = coddepto;
    }

    public int getCodprov() {
        return codprov;
    }

    public void setCodprov(int codprov) {
        this.codprov = codprov;
    }

    public int getCoddist() {
        return coddist;
    }

    public void setCoddist(int coddist) {
        this.coddist = coddist;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @XmlTransient
    public List<Clinica> getClinicaList() {
        return clinicaList;
    }

    public void setClinicaList(List<Clinica> clinicaList) {
        this.clinicaList = clinicaList;
    }

    @XmlTransient
    public List<Persona> getPersonaList() {
        return personaList;
    }

    public void setPersonaList(List<Persona> personaList) {
        this.personaList = personaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idUbigeo != null ? idUbigeo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ubigeo)) {
            return false;
        }
        Ubigeo other = (Ubigeo) object;
        if ((this.idUbigeo == null && other.idUbigeo != null) || (this.idUbigeo != null && !this.idUbigeo.equals(other.idUbigeo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Ubigeo[ idUbigeo=" + idUbigeo + " ]";
    }
    
}
